//全局控制器
import Vue from 'vue';
import subBtn from "@/components/basic/subBtn.vue";
import nodata from "@/components/basic/nodata.vue";
import loading from "@/components/basic/loading.vue";
import UserSidebar from "@/components/layouts/UserSidebar.vue";
import DefalutLoadMore from "@/components/loadmore/DefalutLoadMore.vue";
import tips from "@/common/tips.js";
import store from "@/store";
Vue.component("sub-btn", subBtn);
Vue.component("Nodata", nodata);
Vue.component("Loading", loading);
Vue.component("UserSidebar", UserSidebar);
Vue.component("DefalutLoadMore", DefalutLoadMore);
Vue.prototype.tips = tips;
Vue.prototype.store = store;
const mixin = {
  layout: "app",
  data() {
    return {
      baseUser: process.env.BASE_URL,
    }
  },
  //全局计算属性
  computed: {
    isLogin() { //当前是否登录,true:已登录,false:未登录
      return this.$store.state.user.isLogin;
    },
    isMobile() { //当前是否在移动端,true:是,false:不是
      return this.$store.state.isMobile;
    }
  },
  mounted() {
    //监听页面滚动
    window.addEventListener("scroll", this.pageScroll);
  },
}
Vue.mixin(mixin); //全局混入
//全局调用一次方法
// export default ({
//   app,
//   store
// }) => {
//   console.log("app")
// }
